let redLoginData={
    uid:localStorage['uid']?localStorage['uid']:'',
    username:localStorage['username']?localStorage['username']:'',
    authtoken:localStorage['authtoken']?localStorage['authtoken']:'',
    isLogin:localStorage['isLogin']?Boolean(localStorage['isLogin']):false
};
export default function redLogin(state=redLoginData,action) {
    switch (action.type) {
        case  'redLogin':
            localStorage['uid']=action.data.uid;
            localStorage['username']=action.data.username;
            localStorage['authtoken']=action.data.authtoken;
            localStorage['isLogin']=action.data.isLogin;

            return Object.assign({},state,action.data);
        case 'redOutLogin':
            localStorage.clear();
            localStorage.removeItem('aid')
            sessionStorage.removeItem('aid')
            return Object.assign({},state,action.data)
        default:
            return state
    }
}